﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using StarcraftDemo4;

namespace StarcraftDemo4Site.Controllers
{
    public class HomeController : Controller
    {

        private SC2ResultsGamesEntities db = new SC2ResultsGamesEntities();
        //
        // GET: /Home/

        public ActionResult Index()
        {
            var game_max_marines =
            from result in db.Results
            where result.Marines == db.Results.Max(res => res.Marines)
            where result.Marines != 0
            select result;

            var game_max_minerals =
            from result in db.Results
            where result.Minerals == db.Results.Max(res => res.Minerals)
            where result.Minerals != 0
            select result;

            var game_max_maurader =
            from result in db.Results
            where result.Marauder == db.Results.Max(res => res.Marauder)
            where result.Marauder != 0
            select result;

            ViewData["marine"] = game_max_marines;
            ViewData["maurader"] = game_max_maurader;
            ViewData["mineral"] = game_max_minerals;
            StarcraftDemo4Site.Models.Searchq search_instance = new StarcraftDemo4Site.Models.Searchq();
            return View(search_instance);
        }


    }
}
